﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Payroll.BusinessLogic.Package;
using Payroll.Common.Utils;
using PayrollHR.Web;
namespace PayrollHR.Administration.Modules
{
    public partial class PackageSearchControl : BasePayrollAdministrationUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ListItem ddlCustTypeItem2 = new ListItem("All", "0");
                ddlPackagedate.Items.Add(ddlCustTypeItem2);
                ddlCustTypeItem2 = new ListItem("6 Tháng ", "1");
                ddlPackagedate.Items.Add(ddlCustTypeItem2);
                ddlCustTypeItem2 = new ListItem("1 Năm ", "2");
                ddlPackagedate.Items.Add(ddlCustTypeItem2);
                ddlCustTypeItem2 = new ListItem("2 Năm ", "3");
                ddlPackagedate.Items.Add(ddlCustTypeItem2);
                ddlCustTypeItem2 = new ListItem("3 Năm ", "4");
                ddlPackagedate.Items.Add(ddlCustTypeItem2);
                ddlCustTypeItem2 = new ListItem(" All ", "0");
                ddlPackageType.Items.Add(ddlCustTypeItem2);
                ddlCustTypeItem2 = new ListItem(" Mới ", "1");
                ddlPackageType.Items.Add(ddlCustTypeItem2);
                ddlCustTypeItem2 = new ListItem(" Chuyển Đổi ", "2");
                ddlPackageType.Items.Add(ddlCustTypeItem2);
                ddlCustTypeItem2 = new ListItem(" Gia Hạn ", "3");
                ddlPackageType.Items.Add(ddlCustTypeItem2);
            }
        }
        public Payroll.BusinessLogic.Package.PackageSearch GetPackage()
        {
            int packdate = 0;
            int packtype = 0;
            if (ddlPackagedate.SelectedIndex > -1)
            {
                packdate = int.Parse(ddlPackagedate.SelectedItem.Value);
            }
            if (ddlPackageType.SelectedIndex > -1)
            {
                packtype = int.Parse(ddlPackageType.SelectedItem.Value);
            }
            Payroll.BusinessLogic.Package.PackageSearch pack = new Payroll.BusinessLogic.Package.PackageSearch
            {
                UserId = CommonHelper.ToInteger(hfdUserId.Value),
                PackName = txtPackageName.Text,
                PackType = packtype,
                PackDate = packdate
            };
            return pack;

        }

    }
}